package com.main.organizationandplatformmanagement.interfaces.assembler;

import com.main.common.base.base.BaseAssembler;
import com.main.organizationandplatformmanagement.domain.platform.entity.Platform;
import com.main.organizationandplatformmanagement.interfaces.dto.PlatformDTO;
import jakarta.annotation.Resource;

import java.util.ArrayList;
import java.util.List;

public class PlatformAssembler {
    private BaseAssembler<Platform, PlatformDTO> baseAssembler;

    public List<PlatformDTO> toDTOs(List<Platform> platformList) {
        List<PlatformDTO> platformDTOList = new ArrayList<>();
        for (Platform entity : platformList) {
            PlatformDTO platformDTO = new PlatformDTO();
            platformDTO = baseAssembler.toDTO(entity, platformDTO);
            platformDTO.setPlatformKey(entity.getPlatformKey());
            platformDTO.setAuthorizationCode(entity.getAuthorizationCode());
            platformDTO.setValidPeriod(entity.getValidPeriod());
            platformDTO.setHierarchyId(entity.getHierarchyId());
            platformDTOList.add(platformDTO);
        }
        return platformDTOList;
    }

}